//
//  UIButton+Extension.swift
//  iOSWeibo
//
//  Created by why on 16/7/29.
//  Copyright © 2016年 王浩宇. All rights reserved.
//

import UIKit

extension UIButton {
    
    convenience init(imageName: String,title: String,titleColor: UIColor = UIColor.darkGrayColor(),titleFont: CGFloat = 15,bkgImageName: String="timeline_card_bottom_background") {
        self.init()
        
        self.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(titleColor, forState: UIControlState.Normal)
        self.titleLabel?.font = UIFont.systemFontOfSize(titleFont)
        self.setBackgroundImage(UIImage(named: bkgImageName), forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named: bkgImageName + "_highlighted"), forState: UIControlState.Highlighted)
    }
}